<?php
/**
 * Created by PhpStorm.
 * User: lzq
 * Date: 2018-12-14
 * Time: 17:00
 */

namespace console\controllers;
use yii\console\Controller;
use common\models\Activity;
class AutoShelfController extends Controller
{
    public function actionIndex(){


        $attributes=['status'=>2];
        $condition="start_time >= '".date("Y-m-d H:i:s")."' or end_time <= '".date("Y-m-d H:i:s")."'";

        $result=Activity::updateAll($attributes,$condition);
        if($result){
            echo date("Y-m-d H:i:s");
            echo "\r\n";
        }

    }
}